<!DOCTYPE html>
<html>
<head>
  <title>欢迎登录</title>
  <link rel="stylesheet" type="text/css" href="/bootstrap/css/bootstrap.min.css">
  <script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
      <div class="container" style="margin-top:180px; ">

        <div class="col-md-6 col-md-offset-3">
            <div class="panel panel-primary">
                <div class="panel-heading">登录学生管理系统</div>
                <div class="panel-body">
                   <div class="form-horizontal">
                        <div class="form-group">
                            <label for="uname" class="col-sm-2 control-label">用户名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="username" id="usernameId" placeholder="请输入用户名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="pwd" class="col-sm-2 control-label">密码</label>
                            <div class="col-sm-10">
                                <input type="password" class="form-control" name="password" id="passwordId" placeholder="请输入密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="pwd" class="col-sm-2 control-label">验证码</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="vcode" id="vcodeId" placeholder="请输入验证码">
                            </div>
                            <div class="col-sm-3">
                                <img id="vcodeimg" src="/account/vcode">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <!-- submit有一个默认的提交行为，不要加上 -->
                                <!-- <button type="submit" onclick="login()"  class="btn btn-default">登录</button> -->
                                <button onclick="login()"  class="btn btn-default">登录</button>
                                &nbsp;&nbsp;
                                <input  onclick="register();" type="button"  value="注册" class="btn btn-danger">
                            </div>
                        </div>
                   </div>
                </div>
            </div>
            </div>
    </div>
</body>
<script type="text/javascript">
    //登录
    function login(){
        $.post('/account/login',{
            vcode:$("#vcodeId").val(),
            username:$("#usernameId").val(),
            password:$("#passwordId").val()
        },function(data){
            console.log(status)
            if(data.status==1){
                alert(data.message)
            }else if(data.status==0){
                alert(data.message)
            }

            
            
        })
    }


    $('#vcodeimg').on('click',function(){
        $(this).attr('src','/account/vcode?'+Math.random())
    })
</script>
</html>
